package com.smart.campus.school.service.impl;

import java.util.List;
import com.smart.campus.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smart.campus.school.mapper.AttendanceRecordMapper;
import com.smart.campus.school.domain.AttendanceRecord;
import com.smart.campus.school.service.IAttendanceRecordService;
import com.smart.campus.common.core.text.Convert;

/**
 * 打卡记录Service业务层处理
 * 
 * @author Zhihe.Li
 * @date 2020-10-21
 */
@Service
public class AttendanceRecordServiceImpl implements IAttendanceRecordService 
{
    @Autowired
    private AttendanceRecordMapper attendanceRecordMapper;

    /**
     * 查询打卡记录
     * 
     * @param id 打卡记录ID
     * @return 打卡记录
     */
    @Override
    public AttendanceRecord selectAttendanceRecordById(Long id)
    {
        return attendanceRecordMapper.selectAttendanceRecordById(id);
    }

    /**
     * 查询打卡记录列表
     * 
     * @param attendanceRecord 打卡记录
     * @return 打卡记录
     */
    @Override
    public List<AttendanceRecord> selectAttendanceRecordList(AttendanceRecord attendanceRecord)
    {
        return attendanceRecordMapper.selectAttendanceRecordList(attendanceRecord);
    }

    /**
     * 新增打卡记录
     * 
     * @param attendanceRecord 打卡记录
     * @return 结果
     */
    @Override
    public int insertAttendanceRecord(AttendanceRecord attendanceRecord)
    {
        attendanceRecord.setCreateTime(DateUtils.getNowDate());
        return attendanceRecordMapper.insertAttendanceRecord(attendanceRecord);
    }

    /**
     * 修改打卡记录
     * 
     * @param attendanceRecord 打卡记录
     * @return 结果
     */
    @Override
    public int updateAttendanceRecord(AttendanceRecord attendanceRecord)
    {
        return attendanceRecordMapper.updateAttendanceRecord(attendanceRecord);
    }

    /**
     * 删除打卡记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAttendanceRecordByIds(String ids)
    {
        return attendanceRecordMapper.deleteAttendanceRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除打卡记录信息
     * 
     * @param id 打卡记录ID
     * @return 结果
     */
    @Override
    public int deleteAttendanceRecordById(Long id)
    {
        return attendanceRecordMapper.deleteAttendanceRecordById(id);
    }
}
